<?php

use Phalcon\Validation,
    Phalcon\Validation\Validator\PresenceOf,
    Phalcon\Validation\Validator\Email;
use Phalcon\Validation\Validator\Confirmation;
use Phalcon\Validation\Validator\StringLength;


class RegistrationValidation extends Validation
{
    public function initialize()
    {
        
        $this->setFilters('fname','trim');
        $this->setFilters('mname','trim');
        $this->setFilters('lname','trim');

        $this->add('fname', new PresenceOf(array(
            'message' => '*The firstname is required'
        )));

        $this->add('lname', new PresenceOf(array(
            'message' => '*The lastname is required'
        )));
        
        $this->add('email', new PresenceOf(array(
            'message' => '*The e-mail is required'
        )));

        $this->add('email', new Email(array(
            'message' => '*The e-mail is not valid'
        )));

    /*    $this->add('password', new Confirmation(array(
           'message' => '*Password doesn\'t match confirmation',
           'with' => 'confirm',
           'cancelOnFail' => true
        )));

        $this->add('password', new StringLength(array(
           'messageMinimum' => '*Password must have atleast 8 characters',
           'min' => 8
        )));    
    */
    }
}